import socket


s = socket.socket()

host = socket.gethostname()
port = 1234

# 直接用IP
s.bind(('127.0.0.1', port))

s.listen(5)
while True:
    c, addr = s.accept()
    print('Got connection from', addr)
    c.send('Thank you for connecting'.encode())
    c.close()
